<extend name="Index:index" />
    <block name="nav1">
        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">Admin</a>
            </li>
            <li class="active">课程管理</li>
        </ul><!-- .breadcrumb -->
    </block>

    <block name="nav2">
        <h1>
        课程管理
            <small>
                <i class="icon-double-angle-right"></i>
                <{$action}>
            </small>
        </h1>
    </block>
	
    <block name="main">
    <script>
    $(function(){
    	$('[name="type_one"]').change(function(){
    		var pid=$(this).val();
    		var data="pid="+pid;
    		$.ajax({
    			url:"<{:U('Course/sel_class')}>",
    			type:"post",
    			data:data,
    			dataType:"json",
    			success:function(data){
    				$('[name="type_two"]').html("");
    				if(data){
    					$.each(data,function(i,val){
    						var obj='<option value="'+val['id']+'"';
    						if('<{$info['type_two']}>'== val['id']){
    							obj+='selected="selected"';
    						}
    						obj+='>'+val['name']+'</option>';
    						
    						$('[name="type_two"]').append(obj);
    					});
    					
    				}
    			}
    		});
    	});
    });
    
    </script>
        <div class="row">
            <div class="col-sm-6">
                <form action="<{:U('Course/add_course')}>" enctype="multipart/form-data" method="post">
					<input type="hidden" name="type" value="<{$_GET['type']}>"/>
					<input type="hidden" name="sign" value="<{$_GET['sign']}>"/>
					<input type="hidden" name="id" value="<{$info.id}>"/>
                    <div class="form-group">
                        <label for="">课程名称:</label>
                        <input type="text" class="form-control" name="course_name" <if condition="$_GET[type] eq 1">value="<{$info.course_name}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">课程分类:</label>
                        <div>
                        <select name="type_one" style="margin-right:15px;" >
                        	
                        	<foreach name="class" item="vo">
                        		<option value="<{$vo.id}>" <if condition="$info['type_one'] eq $vo['id']">selected="selected"</if>><{$vo.name}></option>
                        	</foreach>
                        </select>
                        <select name="type_two" >
                        	
                        	<foreach name="class_two" item="vo">
                        		<option value="<{$vo.id}>" <if condition="$info['type_two'] eq $vo['id']">selected="selected"</if>><{$vo.name}></option>
                        	</foreach>
                        </select>
                        <select name="type_three">
							<option value="1" <if condition="$info['type_three'] eq 1">selected="selected"</if>>初级</option>
							<option value="2" <if condition="$info['type_three'] eq 2">selected="selected"</if>>中级</option>
							<option value="3" <if condition="$info['type_three'] eq 3">selected="selected"</if>>高级</option>
						</select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="">课程类型:</label>
                        <div>
                        <select name="course_type" style="margin-right:15px;" >
                        	<option value="常用视频格式" <if condition="$info['course_type'] eq '常用视频格式'">selected="selected"</if>>常用视频格式</option>
                        	<option value="pdf" <if condition="$info['course_type'] eq 'pdf'">selected="selected"</if>>pdf</option>
                        </select>
                        
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="">上课时间:</label>
                        <input type="text" class="form-control" name="start_time" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" <if condition="$_GET[type] eq 1">value="<{$info.start_time}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">结束时间:</label>
                        <input type="text" class="form-control" name="end_time" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"<if condition="$_GET[type] eq 1">value="<{$info.end_time}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">停留时间:</label>
                        <input type="text" class="form-control" name="stop_time" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"<if condition="$_GET[type] eq 1">value="<{$info.stop_time}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">上课地点:</label>
                        <input type="text" class="form-control" name="course_area" <if condition="$_GET[type] eq 1">value="<{$info.course_area}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">课程封面图片:</label>
                        <input type="file" name="course_logo" class="file" <if condition="$_GET[type] eq 1">value="<{$info.course_logo}>"</if>/>
                    </div>
                    <div class="form-group">
                        <label for="">课程简介:</label>
                        <textarea type="text" class="form-control" name="introduce" ><{$info.introduce}></textarea>
                    </div>
                    <div class="form-group">
                        <label for="">讲师:</label>
                        <input type="text" class="form-control" name="lecturer" <if condition="$_GET[type] eq 1">value="<{$info.lecturer}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">可报名人数:</label>
                        <input type="text" class="form-control" name="enroll_limit" <if condition="$_GET[type] eq 1">value="<{$info.enroll_limit}>"</if>>
                    </div>
                    <div class="form-group">
                        <label for="">报名状态:</label>
                        <input type="radio" name="enroll_status" <if condition="$info['enroll_status'] eq 0">checked="checked"</if> value="0"/>报名未开始
                        <input type="radio" name="enroll_status" <if condition="$info['enroll_status'] eq 1">checked="checked"</if> value="1"/>报名开始
                        <input type="radio" name="enroll_status" <if condition="$info['enroll_status'] eq 2">checked="checked"</if> value="2"/>报名结束
                    </div>
                    <div class="form-group">
                        <label for="">课程状态:</label>
                        <input type="radio" name="course_status" <if condition="$info['course_status'] eq 0">checked="checked"</if> value="0"/>未开始
                        <input type="radio" name="course_status" <if condition="$info['course_status'] eq 1">checked="checked"</if> value="1"/>正在进行中
                        <input type="radio" name="course_status" <if condition="$info['course_status'] eq 2">checked="checked"</if> value="2"/>已结束
                    </div>
                    <div class="form-group">
                        <label for="">是否为公开课:</label>
                        <input type="radio" name="if_public" <if condition="$info['if_public'] eq 0">checked="checked"</if> value="0"/>否
                        <input type="radio" name="if_public" <if condition="$info['if_public'] eq 1">checked="checked"</if> value="1"/>是
                    </div>
                    <!-- <div class="form-group">
                        <label for="">是否为直播:</label>
                        <input type="radio" name="if_live" <if condition="$info['if_live'] eq 0">checked="checked"</if> value="0"/>否
                        <input type="radio" name="if_live" <if condition="$info['if_live'] eq 1">checked="checked"</if> value="1"/>是
                    </div>
                    <div class="form-group">
                        <label for="">直播url:</label>
                        <input type="text" class="form-control" name="live_url" <if condition="$_GET[type] eq 1">value="<{$info.live_url}>"</if>>
                    </div> -->
                    
                    <if condition="$_GET[type] neq 1">
                    	<input type="submit" name="submit" class="btn btn-default bton" value="添加">
                    <else/>
                    	<input type="submit" name="submit" class="btn btn-default bton" value="修改">
                    </if>
                    
                    </table>
                </form>
            </div>
        </div>

    </block>
